#!/usr/bin/python
# -*- coding: utf-8 -*-
#-------------------------------------------------
#Create At: 2008-12-17 下午01:12:24 
#Create By: Fla.sam
#
#DESC:
#
#-------------------------------------------------

from django import forms
from django.contrib.auth import login, logout, authenticate
from django.http import HttpRequest, HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import Context, Template, loader, RequestContext
from forms import *

# Create your views here.

def index_view(request):
    '''
    auto redirect root path to /home
    @param request:
    '''
    return HttpResponseRedirect('/home')

def home_view( request ):
    '''
    default home page
    @param request:
    '''
    d = {}
    if request.user.is_authenticated and request.user.is_active:
        return render_to_response( 'index.html', d, context_instance = RequestContext( request ) )
    else:
        return HttpResponseRedirect( '/account/login' )
    
def user_profile_view( request ):
    d = {}
    if request.user.is_authenticated and request.user.is_active:
        return render_to_response( 'index.html', d, context_instance = RequestContext( request ) )
